<template>
    <el-pagination background="" @size-change="handleSizeChange" @current-change="handleCurrentChange"
        :current-page="paginationData.currentPage" :page-sizes="[10, 20, 30, 40]" :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper" :total="paginationData.totals">
    </el-pagination>
</template>
<script>
import { mapState, mapMutations } from 'vuex';
export default {
    name: 'Pagination',
    components: {

    },
    mixins: [],
    props: ['paginationData'],
    data() {
        return {
            // currentPage: 1,
            // pageSize: 10
        }
    },
    computed: {
        ...mapState('paginationStore', ['currentPage', 'pageSize'])
    },
    watch: {

    },
    mounted() {

    },
    methods: {
        ...mapMutations('paginationStore', ['currPage']),
        handleSizeChange(pageSize) {
            console.log(`每页 ${pageSize} 条`);
        },
        handleCurrentChange(currentPage) {
            this.currPage(currentPage)
            // this.$bus.$emit('currentPageData',currentPage)
            console.log(`当前页: ${currentPage}`);
        }
    }
};
</script>
<style lang='less' scoped></style>